package com.common.mq;

import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class MQSender {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    public void send(FileMessage fileMessage){
        String json = JSON.toJSONString(fileMessage);
        log.info("send："+json);
        rabbitTemplate.convertAndSend(MQConfig.QUEUE,json);
    }
}
